//
//  UserLoginDataModel.m
//  GSCalendar
//
//  Created by guoshikeji_a on 2018/9/7.
//  Copyright © 2018年 tanyin. All rights reserved.
//

#import "UserLoginDataModel.h"

#import <JWT.h>

@implementation UserLoginDataModel
//解码出用户信息
- (void)setJwt:(NSString *)jwt {
    _jwt = jwt;
    //
    NSDictionary *dic = [JWT decodeMessage:jwt withSecret:@"1003" withError:nil withForcedAlgorithmByName:@"HS256" skipVerification:true];//payload
    NSDictionary *payload = dic[@"payload"];
    if (payload) {
        self.userInfo = [UserInfoModel yy_modelWithJSON:payload];
    }else {
        self.userInfo = nil;
    }
}

@end
